package com.mindao.app.basic.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
/* 版权所有： 广州敏道科技有限公司
/*
/* 功能描述：
/*
/* 创 建 人：李国才
/* 创建时间：2016年7月8日 上午11:04:43 	
 **/

public class HelloServlet extends HttpServlet{
	//接收post方法
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    	String account=request.getParameter("account");
    	response.getWriter().println("hello Get "+account);
 
    }
	//接收post方法
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    	String account=request.getParameter("account");
    	request.getSession().setAttribute("account", account);
    	
    	response.setContentType("text/html;charset=utf-8");
	    response. setCharacterEncoding("UTF-8");
    	response.getWriter().println("hello Post "+account);
    	//redirect方式
    	//response.sendRedirect("http://www.baidu.com");
    	//forward方式
    	//request.getRequestDispatcher("index.html").forward(request, response);
 
    }
}
